% FILE. . . . . /usr/bloom2/slang/hassan/papers/lasc/kluwer.bst
% EDIT BY . . . Hassan Ait-Kaci
% ON MACHINE. . Phoebus.Aca.Mcc.Com
% STARTED ON. . Wed May 25 11:56:04 1988

% BibTeX style file for Kluwer Academic Pubishers
% Adapted by Hassan Ait-Kaci (hassan@mcc.com) from
% BibTeX standard bibliography style `plain' and `alpha'
	% version 0.98c for BibTeX versions 0.98i or later, LaTeX version 2.08
	% Copyright (C) 1985, all rights reserved
	% Copying of this file is authorized only if either
	% (1) you make absolutely no changes to your copy, including name, or
	% (2) if you do make changes, you name it something other than
	% btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst
	% This restriction helps ensure that all standard styles are identical

ENTRY {
    address
    author
    booktitle
    chapter
    edition
    editor
    howpublished
    institution
    journal
    key
    location
    month
    note
    number
    organization
    pages
    publisher
    school
    series
    title
    type
    volume
    year
  }
  {}
  { label }

INTEGERS { output.state before.all mid.sentence after.sentence after.block blank.or.comma }

FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
  #0 'blank.or.comma :=
}

STRINGS { s t }

FUNCTION{inc.blank.or.comma}
{ blank.or.comma #2 =
    { #0 'blank.or.comma := }
    { blank.or.comma #1 + 'blank.or.comma := }
  if$
}

FUNCTION {output.nonnull}
{ 's :=
  output.state mid.sentence =
    { blank.or.comma #0 =
        { ", " * write$ }
        { " " * write$
          inc.blank.or.comma
        }
      if$
    }
    { output.state after.block =
	{ add.period$ write$
	  newline$
	  "\newblock " write$
	}
	{ output.state before.all =
	    { write$ }
	    { add.period$ " " * write$ }
	  if$
	}
      if$
      #0 'blank.or.comma :=
    }
  if$
  mid.sentence 'output.state :=
  s
}

FUNCTION {output}
{ 's :=
  s "" =
    'skip$
    { s output.nonnull
    }
  if$
}

FUNCTION {output.check}
{ 's :=
  't :=
  s "" =
    { "Warning: the " t * " shouldn't be empty in " * cite$ * top$
    }
    { s output.nonnull
    }
  if$
}

FUNCTION {output.bibitem}
{ newline$
  "\bibitem{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

FUNCTION {fin.entry}
{ add.period$
  write$
  newline$
}

FUNCTION {new.block}
{ output.state before.all =
    'skip$
    { after.block 'output.state := }
  if$
}

FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}

FUNCTION {field.or.null}
{ duplicate$
  missing$
    { pop$
      ""
    }
    'skip$
  if$
}

FUNCTION {slantify}
{ 's :=
  s "" =
    { "" }
    { "{\sl " s * "}" * }
  if$
}

INTEGERS{ nameptr namesleft numnames }

STRINGS{ nameresult }

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  "" 'nameresult :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    {
      s nameptr "{vv }{ll}{, jj}{, ff}" format.name$ 't :=
      nameptr #1 >
	{ namesleft #1 >
	    { nameresult ", " * t * 'nameresult := }
	    { numnames #2 >
		{ nameresult "," * 'nameresult := }
		'skip$
	      if$
	      t "others" =
		{ nameresult " {\sl et al.}" * 'nameresult := }
		{ nameresult " and " * t * 'nameresult := }
	      if$
	    }
	  if$
	}
	{ nameresult t * 'nameresult := }
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
  nameresult
}

FUNCTION {format.authors}
{ author missing$
    {""}
    {author format.names}
  if$
}

FUNCTION {format.editors}
{ editor missing$
    { ""
    }
    {
      editor num.names$ #1 >
	{ editor format.names ", editors" * }
	{ editor format.names ", editor" * }
      if$
    }
  if$
}

FUNCTION {format.title}
{ title missing$
    { "" }
    { title "t" change.case$ }
  if$
}

FUNCTION {entry.string.max} { #100 }

FUNCTION {global.string.max} { #300 }

STRINGS{ pageresult }

FUNCTION {n.dashify}
{ 't :=
  "" 'pageresult :=
    { t "" = not }
    { t #1 #1 substring$ "-" =
	{ t #1 #2 substring$ "--" = not
	    { pageresult "--" * 'pageresult :=
	      t #2 global.string.max substring$ 't :=
	    }
	    {   { t #1 #1 substring$ "-" =}
		{ pageresult "-" * 'pageresult :=
		  t #2 global.string.max substring$ 't :=
		}
	      while$
	    }
	  if$
	}
	{ pageresult t #1 #1 substring$ * 'pageresult :=
	  t #2 global.string.max substring$ 't :=
	}
      if$
    }
  while$
  pageresult
}

FUNCTION{format.vol.num}
{ volume field.or.null
  number missing$
    { booktitle missing$
        { "" }
	{ ", " booktitle * }
      if$
    }
    { ", " number *
      booktitle missing$
        { "" }
	{ ", " booktitle * }
      if$
      *
    }
  if$
  *
}

FUNCTION{format.date}
{ inc.blank.or.comma
  year missing$
    { month missing$
	{ "" }
	{ "Warning: there's a month but no year in " cite$ * top$
	  "(" month * ")" *
	}
      if$
    }
    { month missing$
	{ "(" year * ")" * }
	{ "(" month * " " * year * ")" *}
      if$
    }
  if$
}

FUNCTION{format.btitle}
{ title field.or.null
  slantify
}

FUNCTION{format.bvolume}
{ volume missing$
    { series missing$
	{ "" }
	{ series slantify }
      if$
    }
    { "Volume~" volume *
      series missing$
	'skip$
	{ " of " * series slantify * }
      if$
    }
  if$
}

FUNCTION{format.edition}
{ edition empty$
    { "" }
    { output.state mid.sentence =
	{ edition "l" change.case$ " edition" * }
	{ edition "t" change.case$ " edition" * }
      if$
    }
  if$
}

INTEGERS{ multiresult }

FUNCTION{multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t "" = not
      and
    }
    { t #1 #1 substring$ "-" =
      t #1 #1 substring$ "," =
      or
	{ #1 'multiresult := }
	{ t #2 global.string.max substring$ 't := }
      if$
    }
  while$
  multiresult
}

FUNCTION{format.pages}
{ pages missing$
    { "" }
    { pages multi.page.check
%	{ "pages~" pages n.dashify * }
	{ pages n.dashify }
	{ "page~" pages n.dashify * }
      if$
    }
  if$
}

FUNCTION{format.chapter}
{ chapter missing$
    { "" }
    { "chapter~" chapter * }
  if$
}

FUNCTION{format.in.ed.booktitle}
{ booktitle missing$
    { ""
    }
    { format.editors 's :=
      s "" =
	{ "In " booktitle slantify * }
	{ "In " s * ", " * booktitle slantify * }
      if$
    }
  if$
}

FUNCTION{format.tr.number}
{ type missing$
    { "Technical Report" }
    { type }
  if$
  number missing$
    'skip$
    { "~" * number * }
  if$
}

FUNCTION{article}
{ output.bibitem
  "author" format.authors output.check
  new.block
  "title" format.title output.check
  new.block
  "journal" journal field.or.null slantify output.check
  format.vol.num output
  "year" format.date output.check
  format.pages output
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{book}
{ output.bibitem
  author missing$
    { "author and editor" format.editors output.check
    }
    { "author" format.authors output.check
    }
  if$
  new.block
  "title" format.btitle output.check
  new.block
  format.bvolume output
  "publisher" publisher field.or.null output.check
  address field.or.null output
  format.edition output
  "year" format.date output.check
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{booklet}
{ output.bibitem
  format.authors output
  new.block
  "title" format.btitle output.check
  new.block
  howpublished field.or.null output
  address field.or.null
  format.date output
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{inbook}
{ output.bibitem
  author missing$
    { "author and editor" format.editors output.check
    }
    { "author" format.authors output.check
    }
  if$
  new.block
  "title" format.btitle output.check
  new.block
  format.bvolume output
  "publisher" publisher field.or.null output.check
  address field.or.null output
  format.edition output
  "year" format.date output.check
  "chapter" format.chapter output.check
  format.pages output
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{incollection}
{ output.bibitem
  "authors" format.authors output.check
  new.block
  "title" format.title output.check
  new.block
  "booktitle" format.in.ed.booktitle output.check
  format.chapter output
  "publisher" publisher field.or.null output.check
  address field.or.null output
  "year" format.date output.check
  format.pages output
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{intechreport}
{ output.bibitem
  "authors" format.authors output.check
  new.block
  "title" format.title output.check
  new.block
  "booktitle" format.in.ed.booktitle output.check
  format.tr.number output
  "institution" institution field.or.null output.check
  address field.or.null output
  "year" format.date output.check
  format.chapter output
  format.pages output
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{inproceedings}
{ output.bibitem
  "author" format.authors output.check
  new.block
  "title" format.title output.check
  new.block
  "booktitle" format.in.ed.booktitle output.check
  location field.or.null output
  organization field.or.null output
  publisher field.or.null output
  address field.or.null output
  "year" format.date output.check
  format.pages output
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{conference} {inproceedings}

FUNCTION{manual}
{ output.bibitem
  format.authors output
  new.block
  "title" format.btitle output.check
  new.block
  organization field.or.null output
  address field.or.null output
  format.edition output
  format.date output
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{mastersthesis}
{ output.bibitem
  "author" format.authors output.check
  new.block
  "title" format.btitle output.check
  new.block
  "Master's thesis" output
  "school" school field.or.null output.check
  address field.or.null output
  "year" format.date output.check
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{misc}
{ output.bibitem
  format.authors output
  new.block
  format.title output
  new.block
  howpublished field.or.null output
  format.date output
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{phdthesis}
{ output.bibitem
  "author" format.authors output.check
  new.block
  "title" format.btitle output.check
  new.block
  "PhD thesis" output
  "school" school field.or.null output.check
  address field.or.null output
  "year" format.date output.check
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{proceedings}
{ output.bibitem
  editor missing$
    { "editor and organization" organization field.or.null output.check
    }
    { "editor" format.editors output.check
    }
  if$
  new.block
  "title" format.btitle output.check
  publisher field.or.null output
  address field.or.null output
  "year" format.date output.check
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{techreport}
{ output.bibitem
  "author" format.authors output.check
  new.block
  "title" format.btitle output.check
  new.block
  format.tr.number output
  "institution" institution field.or.null output.check
  address field.or.null output
  "year" format.date output.check
  new.block
  note field.or.null output
  fin.entry
}

FUNCTION{unpublished}
{ output.bibitem
  "author" format.authors output.check
  new.block
  "title" format.title output.check
  new.block
  format.date output
  new.block
  "note" note field.or.null output.check
  fin.entry
}

FUNCTION{default.type} {book}

MACRO{jan} {"January"}
MACRO{feb} {"February"}
MACRO{mar} {"March"}
MACRO{apr} {"April"}
MACRO{may} {"May"}
MACRO{jun} {"June"}
MACRO{jul} {"July"}
MACRO{aug} {"August"}
MACRO{sep} {"September"}
MACRO{oct} {"October"}
MACRO{nov} {"November"}
MACRO{dec} {"December"}
MACRO{acmcs} {"ACM Computing Surveys"}
MACRO{acta} {"Acta Informatica"}
MACRO{cacm} {"Communications of the ACM"}
MACRO{ibmjrd} {"IBM Journal of Research and Development"}
MACRO{ibmsj} {"IBM Systems Journal"}
MACRO{ieeese} {"IEEE Transactions on Software Engineering"}
MACRO{ieeetc} {"IEEE Transactions on Computers"}
MACRO{ieeetcad}
 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
MACRO{ipl} {"Information Processing Letters"}
MACRO{jacm} {"Journal of the ACM"}
MACRO{jcss} {"Journal of Computer and System Sciences"}
MACRO{scp} {"Science of Computer Programming"}
MACRO{sicomp} {"SIAM Journal on Computing"}
MACRO{tocs} {"ACM Transactions on Computer Systems"}
MACRO{tods} {"ACM Transactions on Database Systems"}
MACRO{tog} {"ACM Transactions on Graphics"}
MACRO{toms} {"ACM Transactions on Mathematical Software"}
MACRO{toois} {"ACM Transactions on Office Information Systems"}
MACRO{toplas} {"ACM Transactions on Programming Languages and Systems"}
MACRO{tsc} {"Theoretical Computer Science"}

READ

FUNCTION{sort.format.names}
{ 's :=
  #1 'nameptr :=
  "" 'nameresult :=
  s num.names$ 'namesleft :=
    { namesleft #0 > }
    { namesleft #1 - 'namesleft :=
      nameptr #1 >
	{ nameresult "   " * 'nameresult := }
	'skip$
      if$
	nameresult
	  s nameptr "{vv }{ll}{  f}{  jj}" format.name$
	    "l" change.case$
	  purify$
	  *
	'nameresult
	:=
       nameptr #1 =
         { nameresult "   " * namesleft #1 + int.to.str$ *
	   'nameresult
	   := }
	 'skip$
       if$
      nameptr #1 + 'nameptr :=
    }
  while$
  nameresult	% return the result
}

INTEGERS { len }

FUNCTION{chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =		% comparing against w, on the stack
    { s len #1 + global.string.max substring$ }
    { s }
  if$
}

FUNCTION{sort.format.title}
{ 't :=
  "A " #2
    "An " #3
      "The " #4 t chop.word
    chop.word
  chop.word
  #1 global.string.max substring$
  purify$
}

FUNCTION{presort}
{ author missing$
    { editor missing$
	{ key field.or.null }
	{ editor sort.format.names }
      if$
    }
    { author sort.format.names }
  if$
  "    "
  *
  year field.or.null
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.string.max substring$
  'sort.key$ :=
}

ITERATE{presort}

SORT

STRINGS {longest.label}

INTEGERS { number.label longest.label.width }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #1 'number.label :=
  #0 'longest.label.width :=
}

FUNCTION {longest.label.pass}
{ number.label int.to.str$ 'label :=
  number.label #1 + 'number.label :=
  label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
  if$
}

EXECUTE {initialize.longest.label}

ITERATE {longest.label.pass}

FUNCTION{preamble}
{ init.state.consts
  "% Bibliography Style for Kluwer Academic Publishers (May 1988)" write$
  newline$
  "% Adapted by Hassan Ait-Kaci, MCC, Austin, TX (hassan@mcc.com)" write$
  newline$ newline$ 
  "\begin{thebibliography}{" longest.label * "}" * write$
  newline$
}

FUNCTION{finish.up}
{ newline$ "\end{thebibliography}" write$ newline$}

EXECUTE{preamble}

ITERATE{call.type$}

EXECUTE{finish.up}

